home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8044 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.2 KB  |  78 lines

  1. Path: rahul.net!a2i!news
  2. From: terris@rahul.net (Terris Linenbach)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: STL with MSVC++ 4.0
  5. Date: 13 Feb 1996 05:41:07 GMT
  6. Organization: a2i network
  7. Message-ID: <4fp89k$6f8@hustle.rahul.net>
  8. References: <4flp0o$101@lal.interserv.net> <311F7759.530F@best.com>
  9. NNTP-Posting-Host: 534.rahul.net
  10. Mime-Version: 1.0
  11. Content-Type: Text/Plain; charset=US-ASCII
  12. X-Newsreader: WinVN 0.99.6
  13.  
  14. Put
  15.  
  16. using namespace std;
  17.  
  18. at the beginning of your method.
  19.  
  20. - Terris
  21.  
  22. In article <311F7759.530F@best.com>, bobo@best.com says...
  23. >
  24. >dvisage@interserv.com wrote:
  25. >> 
  26. >>  >>include new.h. Beyond that, I'm still tracking down ambiguos operators
  27. >> >>for the iterator types. You can make it work, but its not a gimme.
  28. >> >
  29. >> >>John S.
  30. >> >
  31. >> >Microsoft have a paper on MFC and Standard Template Library at
  32. >> >http://www.microsoft.com/visualc/v4/v4tech/stlchg.htm
  33. >> >
  34. >> >
  35. >> >Cheers,
  36. >> >Peter J Brock
  37. >> >http:/www.magna.com.au/~peter
  38. >> >
  39. >> I have also had similar problems with ambigous iterator operators.  
  40. Especially,
  41. >> the map::iterator.  To get around the namespace problem, you also need to
  42. >> include iostream.h as well as new.h in order for the piece of **** to even
  43. >> compile with MFC source code.
  44. >> 
  45. >> I just recently download a copy of STL dated October 1995 that no longer
  46. >> seem to want to compile my source code.  The previous version that I
  47. >> was using seemed to work.
  48. >> 
  49. >> The problem is an ambiguos map::const_iterator::operator!=()
  50. >
  51. >This is an annoying problem to be sure.  I know of two ways around it:
  52. >
  53. >a) put the code in which the ambiguity arises in the std namespace as well.  
  54. This is 
  55. >not as big a pain as it sounds.  It makes sense from a design point of view 
  56. to 
  57. >encapsulate code that uses STL with other portable code, separate from MFC.
  58. >
  59. >b) Use this notation:
  60. >
  61. >if (std::operator!=(anIter,aMap.end())) {
  62. >...
  63. >}
  64. >
  65. >or somesuch.  You might need to qualify it a bit more, but I've been able to 
  66. get this 
  67. >approach to work.  It is definitely not as preferable as solution a) because 
  68. if you 
  69. >change the map, say, to a vector, this code will have to be replaced by:
  70. >
  71. >if (anIter != aMap.end()) {...}
  72. >
  73. >cheers,
  74. >Eric Bowman
  75. >bobo@best.com
  76. >Maxis Core Technology Group, San Mateo, California, USA
  77.  
  78.